package org.example.serviceImpl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.example.bean.User;
import org.example.mapper.UserMapper;
import org.example.services.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;

    @Override
    public List getUserList() {
        QueryWrapper<User> query = new QueryWrapper<User>();
        return userMapper.selectList(query);
    }

    @Override
    public void save(User user) {
        userMapper.insert(user);
    }

    @Override
    public User selectUser(User user) {
        QueryWrapper<User> query = new QueryWrapper<User>();
        query.eq("user_code",user.getUserCode());
        return userMapper.selectOne(query);
    }

}
